package com.ruoyi.project.person.info.service.impl;

import com.ruoyi.common.utils.security.ShiroUtils;
import com.ruoyi.project.cms.type.domain.CmsType;
import com.ruoyi.project.person.info.domain.PersonInfo;
import com.ruoyi.project.person.info.domain.PersonInfoVo;
import com.ruoyi.project.person.info.mapper.PersonInfoMapper;
import com.ruoyi.project.person.info.service.IPersonInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program:
 * @auther 草莓酸奶~
 * @date 2020-09-17-19:08
 * @description:
 */

@Service
public class PersonInfoServiceImpl  implements IPersonInfoService {

@Autowired
    private PersonInfoMapper personInfoMapper;

    /**
     * 分页查询所有的公告类型
     * @param personInfo 传进来的参数
     * @return 返回公告类型的集合.即分页查询的结果
     */
    @Override
    public List<PersonInfoVo> selectPersonInfoList(PersonInfo personInfo) {

        return personInfoMapper.selectPersonInfoList(personInfo);
    }


    @Override
    public int insertPersonInfo(PersonInfo personInfo) {
        personInfo.setCreateBy(ShiroUtils.getLoginName());
        return personInfoMapper.insertPersonInfo(personInfo);
    }

    @Override
    public String checkPersonInfoNameUnique(PersonInfo personInfo) {
        return null;
    }

    /**
     * 通过公告id查询公告,用于修改时的数据回显操作
     * @param typeId 要修改的公告id
     * @return 查询的数据
     */

    @Override
    public PersonInfo selectPersonInfoById(Long typeId) {

        return personInfoMapper.selectTypeById(typeId);
    }

    @Override
    public int updatePersonInfo(PersonInfo personInfo) {

        return personInfoMapper.updatePersonInfo(personInfo);
    }

    @Override
    public int removePersonInfoById(Long[] ids) {
        return personInfoMapper.removePersonInfoById(ids);

    }

    @Override
    public PersonInfo selectPersonInAndDept(Long infoId) {
        return personInfoMapper.selectPersonInfoAndDept(infoId);
    }

    @Override
    public List<PersonInfo> selectPersonInfoByDeptId(Long deptId) {
        return personInfoMapper.selectPersonInfoByDeptId(deptId);
    }
}
